/*
 *  $Id: CurseOfUnholy.cs 1051 2010-05-18 22:10:41Z thenn.erannor $
 *    This file is a part of Ragima CCG.
 *    (C) 2008 Ragima development group.
 *
 *    Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima.Cards001.Darkness.Spells {
    public class CurseOfUnholy: EnchantmentCard<ChainData> {
        public CurseOfUnholy(): base("001_d_s_curse_of_unholy") {
            Level = CompleteLevel.ReadyForTest;
            Element = ElementType.Darkness;
            Value = 100;
            Target = new ChainTarget(null, GraveyardTarget.Sacrifice, CreatureTarget.Both);
            AddManaCost(ElementType.Darkness, 1);
            AddCondition(new GraveyardCondition(false, false, 1));
        }

        protected override void DoAction(TargetArgs<ChainData> args) {
            TargetArgs<GraveyardData> ga;
            if (!args.Target.GetArgs(0, out ga)) return;
            ga.Target.MoveToSecondDeck();
            base.DoAction(args);
        }
        protected override AbstractObject GetTarget(TargetArgs<ChainData> args) {
            TargetArgs<Creature> ca;
            if (!args.Target.GetArgs(1, out ca)) return null;
            return ca.Target;
        }
        protected override EnchantmentAffect CreateEnchantment() {
            return new CurseOfUnholyAffect();
        }

        private class CurseOfUnholyAffect: EnchantmentAffect<CurseOfUnholy> {
            public CurseOfUnholyAffect() {
                Add(new Affects.Death(2));
                Add(new Affects.Undying(1));
            }
        }
    }
}
